<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>

        function CreateDiv(html) {
            this.html = html;
            this.init()
        }

        CreateDiv.prototype.init = function() {
            var div = document.createElement("div")
            div.innerHTML = this.html;
            document.body.appendChild(div)
        }

        var ProxySingletonCreateDiv = (function() {
            var instance = null;
            return function (a) {
                if(!instance) {
                    instance = new CreateDiv(a)
                }
                return instance
            }   
        })()

        var a =  ProxySingletonCreateDiv("test1")
        var b =  ProxySingletonCreateDiv("test2")

        console.log(a,b, a===b);
    </script>
</body>
</html>